package com.coocaa.app.lib.cleaner.scanner.config.impl;

import android.content.Context;

import com.coocaa.app.lib.cleaner.scanner.config.ConfigDataFactory;
import com.coocaa.app.lib.cleaner.scanner.config.ConfigManagerFactory;


/**
 * Created by lu on 17-4-17.
 */

public class ConfigManager implements ConfigManagerFactory.ConfigLoader {
    private ConfigManagerFactory.ConfigLoader nativeLoader;
    private ConfigManagerFactory.ConfigLoader cloudLoader;

    public ConfigManager() {
    }

    @Override
    public void init(Context context) {
        nativeLoader = new NativeConfigLoader();
        nativeLoader.init(context);
        cloudLoader = new CloudConfigLoader();
        cloudLoader.init(context);
    }


    @Override
    public ConfigDataFactory.ConfigData load() {
        ConfigDataFactory.ConfigData data = new ConfigDataImpl();
        data.appendAll(nativeLoader.load());
        data.appendAll(cloudLoader.load());
        return data;
    }
}
